﻿using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Text;

namespace ConsoleApp39
{
    class Program
    {
        static void Main(string[] args)
        {
            string opi=IpAddress.getopeneye();
            //Console.WriteLine(opi);
            //Console.ReadKey();
            SQLiteConnection conn = null;
            
            // string dbPath = "Data Source =" + Environment.CurrentDirectory + "/AppConfig.db";
            string dbPath = "Data Source =" + "C:\\Program Files (x86)\\OpenEye\\AppConfig.db;Password=Chinaunicom@10010"; //无密码可省略Password=Chinaunicom@10010
            conn = new SQLiteConnection(dbPath);//创建数据库实例，指定文件位置

            conn.Open();//打开数据库，若文件不存在会自动创建  

            SQLiteCommand cmdInsert = new SQLiteCommand(conn);
            cmdInsert.CommandText = "UPDATE AppConfig SET value = '"+ opi +"' WHERE key = 'Account'";//插入几条数据

            cmdInsert.ExecuteNonQuery();

            cmdInsert.CommandText = "UPDATE AppConfig SET value = '1' WHERE key = 'LockAccount'";//插入几条数据

            cmdInsert.ExecuteNonQuery();

            conn.Close();
        }
    }
}
